Skip to content

Skip useless tasks in the worker to improve fast scrolling with scanned books (bug 1866296)#17403

Open
calixteman wants to merge 1 commit intomozilla:masterfrom
calixteman:rm_cancelled_jobs
Open

Skip useless tasks in the worker to improve fast scrolling with scanned books (bug 1866296)#17403
calixteman wants to merge 1 commit intomozilla:masterfrom
calixteman:rm_cancelled_jobs

Conversation

@calixteman
Copy link
Copy Markdown
Contributor

When a page rendering is cancelled, a task is sent to the worker but before it's executed the rendering task is: the cancel task is more or less useless in this case. So in using the fact that draining the message queue has a higher priority than draining the event one, it's possible to get all the current tasks, hence it's possible to cancel some tasks which are before a cancel task.

…ed books (bug 1866296)

When a page rendering is cancelled, a task is sent to the worker but before it's executed
the rendering task is: the cancel task is more or less useless in this case.
So in using the fact that draining the message queue has a higher priority
than draining the event one, it's possible to get all the current tasks, hence
it's possible to cancel some tasks which are before a cancel task.
@calixteman calixteman marked this pull request as ready for review December 12, 2023 20:59
Copy link
Copy Markdown
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but I still consider this really risky since if (or dare I say when) there are problems with this they are going to be highly timing-dependent and thus extremely difficult to debug.

Furthermore, based on a very quick look, once you set this.#isPostponed = true; there's nothing that ever resets it so I don't really understand how this won't also affect all sendWithPromise-calls that happen after the first sendWithStream-invocation?

Could we perhaps try my viewer-only approach first, and see how that behaves in real-life scenarios, since it should be very low risk compared to this?

@marco-c
Copy link
Copy Markdown
Contributor

marco-c commented Mar 11, 2024

This (or something along these lines) could be a nice win on mobile where fast scrolling is very frequent on long documents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: High priority

Development

Successfully merging this pull request may close these issues.

5 participants